<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    let name = "the window"
    let object = {
        name:"My Object",
        getNameFunc:function () {
            return function () {
                    return this.name
            }
        }
    }
    console.log(object.getNameFunc()())
    let name2 = "the window"
    let object2 = {
        name2:"My Object",
        getNameFunc:function () {
            let that = this//闭包
            return function () {
                return that.name2
            }
        }
    }
    console.log(object.getNameFunc()())

    function fun(n,o) {
        console.log(o)
        return{
            fun:function (m) {
                return fun(n,m)
            }
        }
    }
    let a = fun(0);a.fun(1);a.fun(2);a.fun(3);
    let b = fun(0).fun(1).fun(2).fun(3);
    let c = fun(0).fun(1);c.fun(2);c.fun(3);
</script>
</body>
</html>
